package jonaTest;

import junit.framework.TestCase;
import Jona.*;

/**
 * @author Xox Ix
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class TestEvaluation extends TestCase {

	
/* ************************* MONOLECTICAL TESTS *********************** */
	public void testMonolecticalSimpleEvaluation() {
		/*
		 * 0--x 1
		 * 
		 */
		ArgObject[] st = new ArgObject[4];
		Theory th = new Theory();
		int i;
		
		st[0] = new Statement(ArgObject.ASSUMPTION,""+0);
		st[1] = new Statement(ArgObject.ASSUMPTION,""+1);
		st[2] = new Statement(ArgObject.ASSUMPTION,""+2);
		st[3] = new Conditional(st[0],st[1].getNegation());
		for (i = 0; i < st.length; ++i) {
			th.addStatement(st[i]);
		}
		th.removeStatement(st[2]);
		th.removeStatement(st[2]);
		
		th.evaluate();
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[0]));
		assertEquals(ArgObject.EVALUATION_DEFEATED,th.getValue(st[1]));
	}
	
	public void testMonolecticalUnrelatedAttacker() {
		/*    +-------------+
		 *    |             |
		 * 0--+-x 1---x 2   |
		 *    |             |
		 *    |      Theory |
		 *    +-------------+
		 */
		ArgObject[] st = new ArgObject[5];
		Theory th = new Theory();
		int i;
		
		st[0] = new Statement(ArgObject.ASSUMPTION,""+0);
		st[1] = new Statement(ArgObject.ASSUMPTION,""+1);
		st[2] = new Statement(ArgObject.ASSUMPTION,""+2);
		st[4] = new Conditional(st[0],st[1].getNegation());
		st[3] = new Conditional(st[1],st[2].getNegation());
		for (i = 1; i < st.length-1; ++i) {
			th.addStatement(st[i]);
		}

		th.evaluate();
		assertEquals(ArgObject.EVALUATION_UNASSIGNED,th.getValue(st[0]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[1]));
		assertEquals(ArgObject.EVALUATION_DEFEATED,th.getValue(st[2]));
	}

	public void testMonolecticalSelfAttacker() {
		/* 
		 * b--x b
		 * 
		 */
		ArgObject a,b,c;
		
		a = new Statement(ArgObject.ASSUMPTION,"a");
		b = new Statement(ArgObject.ASSUMPTION,"b");
		c = new Conditional(b,b.getNegation());
		
		Theory th = new Theory();
		th.addStatement(a);
		th.addStatement(b);
		th.addStatement(c);
		
		th.evaluate();
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(a));
		assertEquals(ArgObject.EVALUATION_UNKNOWN,th.getValue(b));
	}

	public void testMonolecticalSimpleChain() {
		/*
		 * 18--x 16--x 14--x 12--x 10--x 8--x 6--x 4--x 2--x 0
		 * 
		 */
		ArgObject[] st = new ArgObject[20];
		int i;
		
		st[0] = new Statement(ArgObject.ASSUMPTION,"0");
		Theory th = new Theory();
		th.addStatement(st[0]);
		for (i = 2; i < st.length; i += 2) {
			st[i] = new Statement(ArgObject.ASSUMPTION,""+i);
			st[i+1] = new Conditional(st[i],st[i-2].getNegation());
			th.addStatement(st[i]);
			th.addStatement(st[i+1]);
		}
	
		th.evaluate();
		for (i = st.length-2; i >= 4; i -= 4) {
			assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[i]));
			assertEquals(ArgObject.EVALUATION_DEFEATED,th.getValue(st[i-2]));
		}
	}
	
	public void testMonolecticalComplexChain() {
		/*
		 * 3---x 1---x 0
		 * |    /|
		 * |   / |   x
		 * |  /  |  /
		 * x x   x /
		 *        / 
		 * 4---x 2
		 */
		ArgObject[] st = new ArgObject[5];
		Theory th = new Theory();
		int i;
		
		for (i = 0; i < st.length; ++i) {
			st[i] = new Statement(ArgObject.ASSUMPTION,""+i);
			th.addStatement(st[i]);
		}
		th.addStatement(new Conditional(st[1],st[0].getNegation()));
		th.addStatement(new Conditional(st[2],st[0].getNegation()));
		th.addStatement(new Conditional(st[1],st[2].getNegation()));
		th.addStatement(new Conditional(st[4],st[2].getNegation()));
		th.addStatement(new Conditional(st[3],st[1].getNegation()));
		th.addStatement(new Conditional(st[1],st[4].getNegation()));
		th.addStatement(new Conditional(st[3],st[4].getNegation()));
		
		th.evaluate();
		assertEquals(ArgObject.EVALUATION_DEFEATED,th.getValue(st[0]));
		assertEquals(ArgObject.EVALUATION_DEFEATED,th.getValue(st[1]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[2]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[3]));
		assertEquals(ArgObject.EVALUATION_DEFEATED,th.getValue(st[4]));
	}
	
/* ************************* DIALECTICAL TESTS ************************* */	
	public void testDialecticalAssumptions() {
		ArgObject a = new Statement();
		Theory th = new Theory();
		th.addStatement(a);
		th.evaluate();
		assertEquals(ArgObject.EVALUATION_UNKNOWN,th.getValue(a));
		a.setArgumentType(ArgObject.ASSUMPTION);
		th.evaluate();
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(a));
	}
	
	public void testDialecticalSimpleChain() {
		ArgObject a = new Statement();
		Theory th = new Theory();
		th.addStatement(a);
		th.evaluate();
		assertEquals(ArgObject.EVALUATION_UNKNOWN,th.getValue(a));
		a.setArgumentType(ArgObject.ASSUMPTION);
		th.evaluate();
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(a));
	}

	public void testDialecticalSimpleConflict() {
		/*
		 * 0--> 1
		 * |   
		 * |    x
		 * |    |
		 * \--> 2
		 */
		ArgObject[] st = new ArgObject[3];
		Theory th = new Theory();
		int i;
		
		for (i = 0; i < st.length; ++i) {
			st[i] = new Statement(ArgObject.ASSUMPTION,""+i);
			th.addStatement(st[i]);
		}
		th.addStatement(new Conditional(st[0],st[1]));
		th.addStatement(new Conditional(st[2],st[1].getNegation()));
		th.addStatement(new Conditional(st[0],st[2]));
		th.evaluate();
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[0]));
		assertEquals(ArgObject.EVALUATION_UNKNOWN,th.getValue(st[1]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[2]));
	}

	public void testDialecticalComplexChain() {
		/*
		 *  0--> 1----> 2----x 6
		 *        \   x      x
		 *         \ /      /
		 *          X      /
		 *         / \    /
		 *        /   >  / 
		 *  3--> 4----> 5
		 * 
		 */
		ArgObject[] st = new ArgObject[7];
		Theory th = new Theory();
		int i;
		
		for (i = 0; i < st.length; ++i) {
			st[i] = new Statement(ArgObject.ASSUMPTION,""+i);
			th.addStatement(st[i]);
		}
		th.addStatement(new Conditional(st[0],st[1]));
		th.addStatement(new Conditional(st[1],st[2]));
		th.addStatement(new Conditional(st[4],st[2].getNegation()));
		th.addStatement(new Conditional(st[3],st[4]));
		th.addStatement(new Conditional(st[1],st[5]));
		th.addStatement(new Conditional(st[4],st[5]));
		th.addStatement(new Conditional(st[2],st[6].getNegation()));
		th.addStatement(new Conditional(st[5],st[6].getNegation()));

		th.evaluate();
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[0]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[1]));
		assertEquals(ArgObject.EVALUATION_UNKNOWN,th.getValue(st[2]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[3]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[4]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[5]));
		assertEquals(ArgObject.EVALUATION_DEFEATED,th.getValue(st[6]));
	}
/* ************************* ENTANGLED DIALECTICAL TESTS *************** */	

	public void testEntangledSimpleChain() {
		/*
		 * 0----+
		 *      |
		 * 1----x---> 2
		 * 
		 *            x
		 *            |
		 * 3----------+
		 */
		ArgObject[] st = new ArgObject[7];
		Theory th = new Theory();
		int i;
		
		st[0] = new Statement(ArgObject.ASSUMPTION,""+0);
		st[1] = new Statement(ArgObject.ASSUMPTION,""+1);
		st[2] = new Statement(ArgObject.ASSUMPTION,""+2);
		st[3] = new Statement(ArgObject.ASSUMPTION,""+3);
		st[4] = new Conditional(st[1],st[2]);
		st[5] = new Conditional(st[0],st[4].getNegation());
		st[6] = new Conditional(st[3],st[2].getNegation());
		for (i = 0; i < st.length; ++i) {
			th.addStatement(st[i]);
		}
		th.evaluate();
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[0]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[1]));
		assertEquals(ArgObject.EVALUATION_DEFEATED,th.getValue(st[2]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[3]));
		assertEquals(ArgObject.EVALUATION_DEFEATED,th.getValue(st[4]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[5]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[6]));
	}

	public void testEntangledSmallChain() {
		/*
		 *      +------------0
		 *      |
		 * 1----x---+        x
		 *          |        |
		 * 2--------x--> 3   |
		 * |                 |
		 * +-----------------+
		 * 
		 */
		ArgObject[] st = new ArgObject[8];
		Theory th = new Theory();
		int i;
		
		st[0] = new Statement(ArgObject.ASSUMPTION,""+0);
		st[1] = new Statement(ArgObject.ASSUMPTION,""+1);
		st[2] = new Statement(ArgObject.ASSUMPTION,""+2);
		st[3] = new Statement(ArgObject.ASSUMPTION,""+3);
		st[4] = new Conditional(st[2],st[3]);
		st[5] = new Conditional(st[1],st[4].getNegation());
		st[6] = new Conditional(st[2],st[0].getNegation());
		st[7] = new Conditional(st[0],st[5].getNegation());

		for (i = 0; i < st.length; ++i) {
			th.addStatement(st[i]);
		}
		th.evaluate();
		assertEquals(ArgObject.EVALUATION_DEFEATED,th.getValue(st[0]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[1]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[2]));
		assertEquals(ArgObject.EVALUATION_UNKNOWN,th.getValue(st[3]));
		assertEquals(ArgObject.EVALUATION_DEFEATED,th.getValue(st[4]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[5]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[6]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[7]));
	}

	public void testEntangledConjunct() {
		ArgObject[] st = new ArgObject[8];
		Conjunct c = new Conjunct();
		Conjunct d = new Conjunct();
		Theory th = new Theory();
		int i;
		
		st[0] = new Statement(ArgObject.ISSUE,"Frank heeft Hendrik vermoordt");
		st[1] = new Statement(ArgObject.ASSUMPTION,"Frank heeft Hendrik gedood");
		st[2] = new Statement(ArgObject.ASSUMPTION,"Frank had de intentie Hendrik te vermoorden");
		st[3] = new Statement(ArgObject.ASSUMPTION,"Frank heeft de dood van Hendrik gepland");
		st[4] = new Statement(ArgObject.ASSUMPTION,"Hendrik is niet dood");
		c.addOperand(st[1]);
		c.addOperand(st[2]);
		c.addOperand(st[3]);
		d.addOperand(st[0]);
		st[5] = new Conditional(c,d);
		st[6] = new Conditional(st[4],st[1].getNegation());
		st[7] = new Statement(ArgObject.ISSUE,"Gras is groen");
		d.addOperand(st[7]);
		
		for (i = 0; i < st.length; ++i) {
			th.addStatement(st[i]);
		}
		th.addStatement(c);
		th.addStatement(d);
		th.evaluate();
		assertEquals(ArgObject.EVALUATION_UNKNOWN,th.getValue(st[0]));
		assertEquals(ArgObject.EVALUATION_DEFEATED,th.getValue(st[1]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[2]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[3]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[4]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[5]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[6]));
		assertEquals(ArgObject.EVALUATION_UNKNOWN,th.getValue(st[7]));
		
		assertEquals(ArgObject.EVALUATION_DEFEATED,th.getValue(c));
		assertEquals(ArgObject.EVALUATION_UNKNOWN,th.getValue(d));
	}

/* ************************* POWER TESTS ******************************* */

	public void testOverpowerSimpleEvaluation() {
		/*
		 * 0--x--x 1
		 *    |
		 *    ?    ^
		 * 2-------+
		 */
		ArgObject[] st = new ArgObject[6];
		Theory th = new Theory();
		int i;
		
		st[0] = new Statement(ArgObject.ASSUMPTION,""+0);
		st[1] = new Statement(ArgObject.ASSUMPTION,""+1);
		st[2] = new Statement(ArgObject.ASSUMPTION,""+2);
		st[3] = new Conditional(st[0],st[1].getNegation());
		st[4] = new Conditional(st[2],st[1]);
		st[5] = new Power(st[4],st[3]);
		
		for (i = 0; i < st.length; ++i) {
			th.addStatement(st[i]);
		}
		
		th.evaluate();
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[0]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[2]));
		assertEquals(ArgObject.EVALUATION_DEFEATED,th.getValue(st[3]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[4]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[5]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[1]));
	}

	public void testOverpowerSimpleConflict() {
		/*
		 * 0---->
		 * 1----> 5 x+
		 * 2---->    |
		 *        x  |
		 * 3------+  |
		 * 4---------+
		 * 
		 * 0,1,2 overpowers 3
		 * 4 overpowers 1
		 */
		ArgObject[] st = new ArgObject[13];
		Theory th = new Theory();
		int i;
		
		for (i = 0; i < 6; ++i) {
			st[i] = new Statement(ArgObject.ASSUMPTION,""+i);
			th.addStatement(st[i]);
		}
		st[6] = new Conditional(st[0],st[5]);
		st[7] = new Conditional(st[1],st[5]);
		st[8] = new Conditional(st[2],st[5]);
		st[9] = new Conditional(st[3],st[5].getNegation());
		st[10] = new Conditional(st[4],st[5].getNegation());
		st[11] = new Power(new Conjunct(new ArgObject[]{st[6],st[7],st[8]}),st[9]);
		st[12] = new Power(st[10],st[7]);
		for (i = 6; i < 13; ++i) {
			th.addStatement(st[i]);
		}
		
		th.evaluate();
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[0]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[1]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[2]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[3]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[4]));
		assertEquals(ArgObject.EVALUATION_UNKNOWN,th.getValue(st[5]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[6]));
		assertEquals(ArgObject.EVALUATION_DEFEATED,th.getValue(st[7]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[8]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[9]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[10]));
	}

	public void testOverpowerBiDirectionalConflict() {
		/*
		 * 0---->   x----4
		 * 1----> 3 x----5
		 * 2---->   x----6
		 * 
		 * 0,1,2 overpowers 5
		 * 4,5,6 overpowers 1
		 */
		ArgObject[] st = new ArgObject[16];
		Theory th = new Theory();
		int i;
		
		for (i = 0; i < 7; ++i) {
			st[i] = new Statement(ArgObject.ASSUMPTION,""+i);
			th.addStatement(st[i]);
		}
		st[7] = new Conditional(st[0],st[3]);
		st[8] = new Conditional(st[1],st[3]);
		st[9] = new Conditional(st[2],st[3]);
		st[10] = new Conditional(st[4],st[3].getNegation());
		st[11] = new Conditional(st[5],st[3].getNegation());
		st[12] = new Conditional(st[6],st[3].getNegation());
		st[13] = new Power(new Conjunct(new ArgObject[]{st[7],st[8],st[9]}),st[11]);
		st[14] = new Power(new Conjunct(new ArgObject[]{st[10],st[11],st[12]}),st[8]);
//		st[15] = new Conditional(st[5],st[7].getNegation());
		for (i = 7; i < 16; ++i) {
			th.addStatement(st[i]);
		}
		
		
		th.evaluate();
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[0]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[1]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[2]));
		assertEquals(ArgObject.EVALUATION_UNKNOWN,th.getValue(st[3]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[4]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[5]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[6]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[7]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[8]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[9]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[10]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[11]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[12]));
		assertEquals(ArgObject.EVALUATION_UNKNOWN,th.getValue(st[13]));
		assertEquals(ArgObject.EVALUATION_UNKNOWN,th.getValue(st[14]));
	}

	public void testOverpowerChainConflict() {
		/*
		 * 0---->   x----4
		 * 1----> 3 x----5
		 * 2---->
		 * 
		 * 0,1,2 overpowers 4,5
		 * 4,5 overpowers 1
		 */
		ArgObject[] st = new ArgObject[16];
		Theory th = new Theory();
		int i;
		
		for (i = 0; i < 6; ++i) {
			st[i] = new Statement(ArgObject.ASSUMPTION,""+i);
			th.addStatement(st[i]);
		}
		st[7] = new Conditional(st[0],st[3]);
		st[8] = new Conditional(st[1],st[3]);
		st[9] = new Conditional(st[2],st[3]);
		st[10] = new Conditional(st[4],st[3].getNegation());
		st[11] = new Conditional(st[5],st[3].getNegation());
//		st[12] = new Conditional(st[6],st[3].getNegation());
		st[13] = new Power(new Conjunct(new ArgObject[]{st[7],st[8],st[9]}),new Conjunct(new ArgObject[]{st[10],st[11]}));
		st[14] = new Power(new Conjunct(new ArgObject[]{st[10],st[11]}),st[8]);
		for (i = 7; i < 15; ++i) {
			th.addStatement(st[i]);
		}
		
		
		th.evaluate();
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[0]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[1]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[2]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[3]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[4]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[5]));
		assertEquals(ArgObject.EVALUATION_UNASSIGNED,th.getValue(st[6]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[7]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[8]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[9]));
		assertEquals(ArgObject.EVALUATION_DEFEATED,th.getValue(st[10]));
		assertEquals(ArgObject.EVALUATION_DEFEATED,th.getValue(st[11]));
		assertEquals(ArgObject.EVALUATION_UNASSIGNED,th.getValue(st[12]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[13]));
		assertEquals(ArgObject.EVALUATION_DEFEATED,th.getValue(st[14]));
	}

	public void testOverpowerTwoStageEvaluation() {
		/*
		 * 0--x----+
		 *    |    x
		 *    |     
		 * 1--?--> 2--?-> 4
		 *            |
		 *            |   x
		 * 3----------x---+
		 */
		ArgObject[] st = new ArgObject[11];
		Theory th = new Theory();
		int i;
		
		for (i = 0; i < 5; ++i) {
			st[i] = new Statement(ArgObject.ASSUMPTION,""+i);
		}
		st[5] = new Conditional(st[0],st[2].getNegation());
		st[6] = new Conditional(st[1],st[2]);
		st[7] = new Conditional(st[2],st[4]);
		st[8] = new Conditional(st[3],st[4].getNegation());
		st[9] = new Power(st[6],st[5]);
		st[10] = new Power(st[7],st[8]);
		
		for (i = 0; i < st.length; ++i) {
			th.addStatement(st[i]);
		}
		
		th.evaluate();
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[0]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[1]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[2]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[3]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[4]));
	}

/* ************************* POWERCONDITIONAL TESTS ******************** */
	
	public void testPowerConditionalSimpleEvaluation() {
		/*
		 * 0=====x 1
		 *     
		 *         ^
		 * 2-------+
		 */
		ArgObject[] st = new ArgObject[5];
		Theory th = new Theory();
		int i;
		
		st[0] = new Statement(ArgObject.ASSUMPTION,""+0);
		st[1] = new Statement(ArgObject.ASSUMPTION,""+1);
		st[2] = new Statement(ArgObject.ASSUMPTION,""+2);
		st[3] = new PowerConditional(st[0],st[1].getNegation());
		st[4] = new Conditional(st[2],st[1]);
		
		for (i = 0; i < st.length; ++i) {
			th.addStatement(st[i]);
		}
		
		th.evaluate();
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[0]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[2]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[3]));
		assertEquals(ArgObject.EVALUATION_DEFEATED,th.getValue(st[4]));
		assertEquals(ArgObject.EVALUATION_DEFEATED,th.getValue(st[1]));
	}

	public void testPowerConditionalConflict() {
		/*
		 * 0=====x 1
		 *     
		 *         ^
		 * 2=======+
		 */
		ArgObject[] st = new ArgObject[5];
		Theory th = new Theory();
		int i;
		
		st[0] = new Statement(ArgObject.ASSUMPTION,""+0);
		st[1] = new Statement(ArgObject.ASSUMPTION,""+1);
		st[2] = new Statement(ArgObject.ASSUMPTION,""+2);
		st[3] = new PowerConditional(st[0],st[1].getNegation());
		st[4] = new PowerConditional(st[2],st[1]);
		
		for (i = 0; i < st.length; ++i) {
			th.addStatement(st[i]);
		}
		
		th.evaluate();
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[0]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[2]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[3]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[4]));
		assertEquals(ArgObject.EVALUATION_UNKNOWN,th.getValue(st[1]));
	}

	public void testPowerConditionalPowerResolution() {
		/*
		 * 0==+==x 1
		 *    |
		 *    ?    ^
		 * 2=======+
		 */
		ArgObject[] st = new ArgObject[6];
		Theory th = new Theory();
		int i;
		
		st[0] = new Statement(ArgObject.ASSUMPTION,""+0);
		st[1] = new Statement(ArgObject.ASSUMPTION,""+1);
		st[2] = new Statement(ArgObject.ASSUMPTION,""+2);
		st[3] = new PowerConditional(st[0],st[1].getNegation());
		st[4] = new PowerConditional(st[2],st[1]);
		st[5] = new Power(st[4],st[3]);
		
		for (i = 0; i < st.length; ++i) {
			th.addStatement(st[i]);
		}
		
		th.evaluate();
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[0]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[2]));
		assertEquals(ArgObject.EVALUATION_DEFEATED,th.getValue(st[3]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[4]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[5]));
		assertEquals(ArgObject.EVALUATION_UNDEFEATED,th.getValue(st[1]));
	}

}
